package com.neuedu.his.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neuedu.his.entity.User;
import com.neuedu.his.service.UserService;

@RestController
public class LoginController {

	@Autowired
	private UserService service;
	
	@RequestMapping("/add")
	//  http://localhost:8088/add?username=1&password=1&realname=1&usetype=1&doctitleid=1&isscheduling=1&deptid=1&registleid=1&delmark=1
	public int add(User u){
		return service.add(u);
	}
	
	@RequestMapping("/login")
	// http:localhost:8088/login?username=admin&password=admin123
	public User login(User u) {
		return service.login(u);
		
	}
	
	@RequestMapping("/logout")
	// http:localhost:8088/logout
	public String logout(HttpSession se) {
		se.invalidate();
		return "ok";
		
	}
}
